package com.zhoux.api.io.io;

import java.io.Serializable;
import java.util.Arrays;

/**
 * @author taoyi
 * @version 1.0
 * @date 2021/3/26 15:47
 *
 * 本类用于测试使用当前类的实例测试对象流的对象读写操作
 *
 */
public class Person implements Serializable {
    static final long serialVersionUID = 42L;
    private String name; // 姓名
    private int age;     // 年龄
    private String gender; // 性别
    // transient 关键字修饰的属性会使得当前类对象在序列化时忽略它, 达到对象 "瘦身" 的目的
    private transient String[] otherInfo; // 其他信息

    public Person(){}

    public Person(String name, int age, String gender, String[] otherInfo) {
        this.name = name;
        this.age = age;
        this.gender = gender;
        this.otherInfo = otherInfo;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }

    public void setOtherInfo(String[] otherInfo) {
        this.otherInfo = otherInfo;
    }

    public String getName() {
        return name;
    }

    public int getAge() {
        return age;
    }

    public String getGender() {
        return gender;
    }

    public String[] getOtherInfo() {
        return otherInfo;
    }

    @Override
    public String toString() {
        return "Person{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", gender='" + gender + '\'' +
                ", otherInfo=" + Arrays.toString(otherInfo) +
                '}';
    }
}
